﻿<%@ Page Culture="auto" UICulture="auto" Title="Dynamic Populate addition" Language="C#"
    MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DynamicPopulateExamplePage.aspx.cs"
    Inherits="BM.Tools.WebControls.MForm.Example.Operations.DynamicPopulateExamplePage" %>

<%@ Register Assembly="BM.Tools.WebControls.MForm" Namespace="BM.Tools.WebControls.MForm.Controls.Additions"
    TagPrefix="mfadd" %>
<%@ Register Assembly="BM.Tools.WebControls.MForm" Namespace="BM.Tools.WebControls.MForm.Controls"
    TagPrefix="mf" %>
<%@ Register Assembly="BM.Tools.WebControls.MForm" Namespace="BM.Tools.WebControls.MForm.Controls.Titles"
    TagPrefix="mftitle" %>
<asp:Content runat="server" ContentPlaceHolderID="Demonstration">
    <p>
        In this demonstration, the <span class="Important">SomeString</span> element on
        change will invoke a webservice GetReverse. The reversed value will be inserted
        into the <span class="Important">InverseString</span> property.
    </p>
    <mf:RootValidator runat="server" ControlToValidate="Root1" />
    <mf:Root ID="Root1" runat="server">
        <Contents>
            <mf:Branch Name="SomeData" runat="server">
                <Contents>
                    <mf:Branch Name="Section" runat="server" MaxOccurs="5">
                        <Contents>
                            <mf:Leaf Name="SomeString" runat="server">
                                <Additions>
                                    <mfadd:DynamicPopulateAddition runat="server" Path="../InverseString">
                                        <Extender runat="server" ServicePath="~/AutoComplete/AutoComplete.asmx" ServiceMethod="GetReverse" />
                                    </mfadd:DynamicPopulateAddition>
                                </Additions>
                            </mf:Leaf>
                            <mf:Leaf Name="InverseString" runat="server" />
                        </Contents>
                    </mf:Branch>
                </Contents>
            </mf:Branch>
        </Contents>
    </mf:Root>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="Description" runat="server">
    <p>
        This page shows how to use the dynamic populate addition functionality
    </p>
    <p>
        The DynamicPopulateExtender is an AjaxControlToolkit control, that lets you fill
        one DOM element with HTML data, when another one is changed. The HTML is returned
        by a web method, that the extender invokes.
    </p>
    <p>
        The web method should take <code>string contextKey</code> as a parameter and return
        a string, which is a HTML content.
    </p>
    <p>
        The DynamicPopulateAddition, that can be used with MForm Leaf items wraps DynamicPopulateExtender
        functionality, to better match the MForm framework.
    </p>
    <p>
        The changing item in DynamicPopulateAddition is always the item, that the addition
        is within. The changed item is the item, that is relative to the changing item,
        and is found with the use of the <code>Path</code> property
    </p>
    <div class="Remark">
        <p>
            The DynamicPopulateAddition will work for all instances of the Leaf that it is defined
            in, it will also work for dynamically added items on client side.</p>
    </div>
</asp:Content>
